import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    // 一级路由
    {
        path: '/shouye',
        name: 'shouye',
        component: () =>
            import ('@/components/shouye.vue'),
        //二级路由
        children: [
            {
            path: '/home',
            name: 'home',
            component: () =>
               import ('@/components/home.vue'),
            },
            {
              path:"/list",
              name:"list",
              component:()=>import("@/components/list.vue")
            },
            {
                path:"/cart",
                name:"cart",
                component:()=>import("@/components/cart.vue"),
            },
            {
                path:"/me",
                name:"me",
                component:()=>import("@/components/me.vue"),
            }
        ]
    },
    {
        path: '/dl',
       name: 'dl',
       component: () =>
           import ('@/components/dl.vue'),
    },
    // 重定向
    {
        path: '/',
        redirect: '/home'
    },


]

const router = new VueRouter({
    routes
})


export default router